package com.kl.feign;


import com.kl.domain.*;
import com.kl.em.Result;
import com.kl.feign.fallback.UserServiceFeignFallback;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@FeignClient(value = "kunlun-material-service",fallback = UserServiceFeignFallback.class)//服务名找项目
public interface UserServiceFeign {
    /* 用户表查询修改 */
    //用户表查询接口，通过用户ID查询
    @GetMapping("/userController")
    Result<UserDTO> selectById(@RequestParam Long userId);

    //用户修改接口，传入一个实体类即可
    @PutMapping("/userController")
    Result updateInfo(@RequestBody UserDTO userDTO);
    /* 联系人表crud */
    //联系人信息查询接口，根据用户名查询
    @GetMapping("/tbContactsController")
    Result<List<TbContactsDTO>> selectById(@RequestParam String userName);

    //联系人信息增加接口，传入一个实体类即可
    @PostMapping("/tbContactsController")
    Result inserInto(@RequestBody TbContactsDTO tbContactsDTO);

    //联系人信息修改接口，传入一个实体类
    @PutMapping("/tbContactsController")
    Result updateInfo(@RequestBody TbContactsDTO tbContactsDTO);

    //联系人信息id删除接口，通过id删除
    @DeleteMapping("/tbContactsController")
    Result deleteById(@RequestParam Long tbId);

    //积分查询接口
    @GetMapping("/userScoreController")
    Result<UserScoreDTO> selectByScoreId(@RequestParam Long userId);

    //积分增加接口
    @PostMapping("/userScoreController")
    Result inserInto(@RequestParam("userId") Long userId,@RequestParam("score") Integer score);

    //积分修改接口
    @PutMapping("/userScoreController")
    Result updateInfo(@RequestParam Long userId,@RequestParam Integer score);

    //积分删除接口
    @DeleteMapping("/userScoreController")
    Result deleteByScoreId(@RequestParam Long userId);

    //优惠券信息查询接口   userId ： 用户id
    @GetMapping("/couponController")
    Result<List<CouponDTO>> selectByCouponId(@RequestParam String userId);

    //优惠券主键id查询接口
    @GetMapping("/couponController/selectId")// @ResponseBody  将后台的数据以json的格式返回前台
    Result<CouponDTO> selectId(@RequestParam String id);

    //优惠券信息增加接口  cid ： 优惠券id
    @PostMapping("/couponController")
    Result insertById(@RequestParam Long userId,@RequestParam Long cid);

    //优惠券信息删除接口
    @DeleteMapping("/couponController")
    Result deleteByCouponId(@RequestParam Long cid);

    //纳税人信息查询接口  通过用户名批量查询
    @GetMapping("/tbTaxpayerController")
    Result<List<TbTaxpayerDTO>> selectByTaxpayerId(@RequestParam String userName);

    //纳税人信息增加接口  实体类
    @PostMapping("/tbTaxpayerController")
    Result inserInto(@RequestBody TbTaxpayerDTO tbTaxpayerDTO);

    //纳税人信息修改接口
    @PutMapping("/tbTaxpayerController")
    Result updateInfo(@RequestBody TbTaxpayerDTO tbTaxpayerDTO);

    //纳税人信息删除接口
    @DeleteMapping("/tbTaxpayerController")
    Result deleteByTaxpayerId(@RequestParam Long tbId);
}